package com.info.zhiduoduo.common.excelconverter;

import com.alibaba.excel.converters.Converter;
import com.alibaba.excel.enums.CellDataTypeEnum;
import com.alibaba.excel.metadata.CellData;
import com.alibaba.excel.metadata.GlobalConfiguration;
import com.alibaba.excel.metadata.property.ExcelContentProperty;
import com.info.zhiduoduo.common.constants.project.ProjectType;

/**
 * @author bob
 * @time 2021/11/8 20:53
 */
public class ProjectTypeConverter implements Converter<Integer> {

    @Override
    public Class supportJavaTypeKey() {
        return null;
    }

    @Override
    public CellDataTypeEnum supportExcelTypeKey() {
        return null;
    }

    @Override
    public Integer convertToJavaData(CellData cellData, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        return 0;
    }

    @Override
    public CellData convertToExcelData(Integer value, ExcelContentProperty contentProperty, GlobalConfiguration globalConfiguration) throws Exception {
        if (value == null) {
            return new CellData("");
        } else if (value == ProjectType.ZHIDUODUO) {
            return new CellData(" 项目");
        } else if (value == ProjectType.CROWDSOURCE) {
            return new CellData("智众包项目");
        } else if (value == ProjectType.TAXER) {
            return new CellData(" 项目");
        } else if (value == ProjectType.LONG_TERM) {
            return new CellData("长期项目");
        } else if (value == ProjectType.ENTRUST_ZHIDUODUO) {
            return new CellData("委托 项目");
        } else if (value == ProjectType.ENTRUST_CROWDSOURCE) {
            return new CellData("委托智众包项目");
        } else if (value == ProjectType.MAKER_GROUPON_ZHIDUODUO) {
            return new CellData("创客团 项目");
        }  else if (value == ProjectType.MAKER_GROUPON_CROWDSOURCE) {
            return new CellData("创客团智众包项目");
        } else {
            return new CellData("");
        }
    }
}
